AAPL iphone release¶

In [1]:
import yfinance as yf
import pandas as pd
import plotly.express as px
In [2]:
data = yf.download("AAPL", start="2012-01-01" ,end = "2023-05-01", interval="1mo")["Adj Close"]
[*********************100%***********************]  1 of 1 completed
In [3]:
returns = data.pct_change()
returns
Out[3]:
Date
2012-01-01         NaN
2012-02-01    0.188311
2012-03-01    0.105283
2012-04-01   -0.025970
2012-05-01   -0.010703
                ...   
2022-12-01   -0.120817
2023-01-01    0.110521
2023-02-01    0.021623
2023-03-01    0.120357
2023-04-01    0.028987
Name: Adj Close, Length: 136, dtype: float64
In [4]:
# resample the data
monthly = returns.resample("M").sum()
toHeatMap = pd.DataFrame(monthly)
toHeatMap["Month"] = toHeatMap.index.month
toHeatMap["Year"] = toHeatMap.index.year
Show = toHeatMap.groupby(by=['Month', 'Year']).sum().unstack()
Show.columns = Show.columns.droplevel(0)
Show.rename(columns={1: "January", 2: "February", 3: "March", 4: "April", 5: "May", 6: "June",
                     7: "July", 8: "August", 9: "September", 10: "October", 11: "November", 12: "December"},
            inplace=True)
Show
Out[4]:
Year 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023
Month
1 0.000000 -0.144089 -0.107697 0.061424 -0.075242 0.047746 -0.010637 0.055154 0.054010 -0.005501 -0.015712 0.110521
2 0.188311 -0.030934 0.051218 0.096449 -0.006677 0.128883 0.063847 0.040315 -0.116798 -0.081085 -0.055269 0.021623
3 0.105283 0.008699 0.026058 -0.027549 0.133327 0.053236 -0.054210 0.101730 -0.067554 0.008845 0.058821 0.120357
4 -0.025970 0.000271 0.099396 0.005786 -0.139921 -0.000070 -0.015020 0.056436 0.155374 0.076218 -0.097131 0.028987
5 -0.010703 0.015697 0.072718 0.040991 0.065287 0.063418 0.130764 -0.127573 0.082165 -0.052107 -0.055883 NaN
6 0.010853 -0.112457 0.033402 -0.033206 -0.036831 -0.053322 -0.005599 0.134873 0.150493 0.100976 -0.080080 NaN
7 0.045822 0.141225 0.028731 -0.032927 0.090063 0.032703 0.027983 0.076394 0.165131 0.064982 0.188634 NaN
8 0.089200 0.076658 0.072176 -0.070404 0.018136 0.102669 0.196227 -0.020184 0.214380 0.040930 -0.032552 NaN
9 0.007102 -0.015028 -0.012184 -0.017389 0.071276 -0.056553 -0.004825 0.077038 -0.100908 -0.066640 -0.119756 NaN
10 -0.107600 0.096382 0.071960 0.083409 0.004334 0.096807 -0.030478 0.110684 -0.060012 0.058657 0.109551 NaN
11 -0.016864 0.063842 0.101204 -0.010042 -0.026599 0.016624 -0.184045 0.074329 0.093606 0.103471 -0.034629 NaN
12 -0.086590 0.014792 -0.067866 -0.106420 0.053336 -0.011706 -0.113616 0.102083 0.116496 0.075797 -0.120817 NaN
In [5]:
# plot the data
fig = px.line(Show)
fig.update_layout(xaxis_title="Month", yaxis_title="Returns",height=700,width=1000)
fig.show()

There's a cyclic trend between the 9th month and the 10th month (iphone release: september/october)

Years not correlated:

  • 2012 (release:iphone 5)
  • 2016 (release:iphone 7/7plus)
  • 2018 (release: iphone xr/xs/xs max)
In [18]:
df = pd.read_html('https://en.wikipedia.org/wiki/IPhone')[3]
df
Out[18]:
model release(d) discontinued support
model with OS date discontinued ended final OS[a] lifespan[b]
model with OS date discontinued ended final OS[a] max[c] min[d]
0 iPhone iPhone OS 1.0 June 29, 2007 June 9, 2008 June 20, 2010 iPhone OS 3.1.3 2 years, 11 months 2 years
1 iPhone 3G iPhone OS 2.0 July 11, 2008 August 9, 2010 March 3, 2011 iOS 4.2.1 2 years, 7 months 6 months
2 iPhone 3GS iPhone OS 3.0 June 19, 2009 September 12, 2012 September 18, 2013 (late, single update: Febru... iOS 6.1.3 (6.1.6) 4 years, 2 months 1 year
3 iPhone 4 iOS 4.0 June 24, 2010 September 10, 2013 September 17, 2014 iOS 7.1.2 4 years, 2 months 1 year
4 iPhone 4S iOS 5.0 October 14, 2011 September 9, 2014 September 12, 2016 (late, single update: July ... iOS 9.3.5 (9.3.6) 4 years, 10 months 2 years
5 iPhone 5 iOS 6.0 September 21, 2012 September 10, 2013 September 18, 2017 (late, single update: July ... iOS 10.3.3 (10.3.4) 4 years, 11 months 4 years
6 iPhone 5C iOS 7.0 September 20, 2013 September 9, 2015 September 18, 2017 iOS 10.3.3 3 years, 11 months 2 years
7 iPhone 5S iOS 7.0 September 20, 2013 March 21, 2016 September 18, 2019 (last security update: Janu... iOS 12.4.1 (12.5.7) 5 years, 11 months 3 years, 5 months
8 iPhone 6 / 6 Plus iOS 8.0 September 19, 2014 September 7, 2016 September 18, 2019 (last security update: Janu... iOS 12.4.1 (12.5.7) 4 years, 11 months 3 years
9 iPhone 6S / 6S Plus iOS 9.0 September 25, 2015 September 12, 2018 August 17, 2022 still supported (latest securi... iOS 15.6.1 (15.7.6) 7 years, 7 months 4 years, 8 months
10 iPhone SE (1st) iOS 9.3 March 31, 2016 September 12, 2018 August 17, 2022 still supported (latest securi... iOS 15.6.1 (15.7.6) 7 years, 1 month 4 years, 8 months
11 iPhone 7 / 7 Plus iOS 10.0 September 16, 2016 September 10, 2019 August 17, 2022 still supported (latest securi... iOS 15.6.1 (15.7.6) 6 years, 8 months 3 years, 8 months
12 iPhone 8 / 8 Plus iOS 11.0 September 22, 2017 April 15, 2020 current latest iOS 5 years, 9 months 3 years, 2 months
13 iPhone X iOS 11.0.1 November 3, 2017 September 12, 2018 current latest iOS 5 years, 7 months 4 years, 9 months
14 iPhone XR iOS 12.0 October 26, 2018 September 14, 2021 current latest iOS 4 years, 8 months 1 year, 9 months
15 iPhone XS / XS Max iOS 12.0 September 21, 2018 September 10, 2019 current latest iOS 4 years, 9 months 3 years, 9 months
16 iPhone 11 iOS 13.0 September 20, 2019 September 7, 2022 current latest iOS 3 years, 9 months 9 months
17 iPhone 11 Pro / 11 Pro Max iOS 13.0 September 20, 2019 October 13, 2020 current latest iOS 3 years, 9 months 2 years, 8 months
18 iPhone SE (2nd) iOS 13.4 April 24, 2020 March 8, 2022 current latest iOS 3 years, 2 months 1 year, 3 months
19 iPhone 12 iOS 14.1 October 23, 2020 NaN current latest iOS 2 years, 8 months NaN
20 iPhone 12 Mini iOS 14.2 November 13, 2020 September 7, 2022 current latest iOS 2 years, 7 months 9 months
21 iPhone 12 Pro / 12 Pro Max iOS 14.1 (12 Pro) iOS 14.2 (12 Pro Max) October 23, 2020 November 13, 2020 September 14, 2021 current latest iOS 2 years, 8 months (12 Pro) 2 years, 7 months (... 1 year, 9 months
22 iPhone 13 / 13 Mini iOS 15.0 September 24, 2021 NaN current latest iOS 1 year, 9 months NaN
23 iPhone 13 Pro / 13 Pro Max iOS 15.0 September 24, 2021 September 7, 2022 current latest iOS 1 year, 9 months 9 months
24 iPhone SE (3rd) iOS 15.4 March 18, 2022 NaN current latest iOS 1 year, 3 months NaN
25 iPhone 14 / 14 Plus iOS 16.0 September 16, 2022 October 7, 2022 NaN current latest iOS 9 months NaN
26 iPhone 14 Pro / 14 Pro Max iOS 16.0 September 16, 2022 NaN current latest iOS 9 months NaN
27 Legend: Discontinued and unsupported Discont... Legend: Discontinued and unsupported Discont... Legend: Discontinued and unsupported Discont... Legend: Discontinued and unsupported Discont... Legend: Discontinued and unsupported Discont... Legend: Discontinued and unsupported Discont... Legend: Discontinued and unsupported Discont... Legend: Discontinued and unsupported Discont...
28 Legend: Discontinued and unsupported Discontinued, bug fixes only Discontinued, still supported Current or still sold NaN NaN NaN
29 Remarks: .mw-parser-output .reflist{font-size:... Remarks: .mw-parser-output .reflist{font-size:... Remarks: .mw-parser-output .reflist{font-size:... Remarks: .mw-parser-output .reflist{font-size:... Remarks: .mw-parser-output .reflist{font-size:... Remarks: .mw-parser-output .reflist{font-size:... Remarks: .mw-parser-output .reflist{font-size:... Remarks: .mw-parser-output .reflist{font-size:...
30 Remarks: .mw-parser-output .reflist{font-size:90%;margi... NaN NaN NaN NaN NaN NaN